Skip to content

fix: expose MRTR state to tool handlers - #1104

Open
DaleSeo wants to merge 1 commit into
mainfrom
fix/mrtr-tool-context
Open

fix: expose MRTR state to tool handlers#1104
DaleSeo wants to merge 1 commit into
mainfrom
fix/mrtr-tool-context

Conversation

@DaleSeo

@DaleSeo DaleSeo commented Jul 31, 2026

Copy link
Copy Markdown
Member

Fixes #1095.

Motivation and Context

ToolCallContext::new was dropping request_state and input_responses, so #[tool] handlers could not continue an MRTR call after the client completed its input requests. Because of that, servers had to bypass the macro routing path and implement ServerHandler::call_tool manually.

This PR preserves the SEP-2322 retry state and input responses when macro-generated tool handlers route calls through ToolCallContext. It also adds extractors for both values and lets #[tool] handlers return CallToolResponse. This allows a single handler to produce both input_required responses and completed results.

How Has This Been Tested?

Added regression tests

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@github-actions github-actions Bot added T-test Testing related changes T-core Core library changes T-handler Handler implementation changes labels Jul 31, 2026
@DaleSeo
DaleSeo marked this pull request as ready for review July 31, 2026 00:22
@DaleSeo
DaleSeo requested a review from a team as a code owner July 31, 2026 00:22
@DaleSeo DaleSeo self-assigned this Jul 31, 2026
@DaleSeo
DaleSeo force-pushed the fix/mrtr-tool-context branch from b0c2ce4 to aff4f5c Compare July 31, 2026 15:11
pub service: &'s S,
pub name: Cow<'static, str>,
pub arguments: Option<JsonObject>,
/// Client responses to input requests from the previous MRTR round.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd strip these comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-handler Handler implementation changes T-test Testing related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#[tool] drops request_state/input_responses, so MRTR handlers cannot use it

2 participants